using System;

namespace Sage.Http.Options
{
    /// <summary>
    /// 请求限流选项
    /// </summary>
    public class RateLimitOptions
    {
        /// <summary>
        /// 是否启用限流
        /// </summary>
        public bool Enabled { get; set; } = false;
        
        /// <summary>
        /// 每秒最大请求数
        /// </summary>
        public int RequestsPerSecond { get; set; } = 10;
        
        /// <summary>
        /// 突发请求数（允许短时间内超过限制的请求数）
        /// </summary>
        public int BurstLimit { get; set; } = 20;
        
        /// <summary>
        /// 队列大小（超过限制时，最多可以排队的请求数）
        /// </summary>
        public int QueueLimit { get; set; } = 50;
        
        /// <summary>
        /// 请求超时时间（毫秒）
        /// </summary>
        public int TimeoutMs { get; set; } = 5000;
        
        /// <summary>
        /// 创建当前选项的副本
        /// </summary>
        public RateLimitOptions Clone()
        {
            return new RateLimitOptions
            {
                Enabled = this.Enabled,
                RequestsPerSecond = this.RequestsPerSecond,
                BurstLimit = this.BurstLimit,
                QueueLimit = this.QueueLimit,
                TimeoutMs = this.TimeoutMs
            };
        }
    }
}